﻿#pragma once

#include "Widgets/Widget.h"
#include "Texture/Texture2D.h"
#include "Render/Widget/ImageWidgetScaleMethod.h"
#include "ImageWidget.m.h"

class RMaterial;

RCLASS()
class WHENGINE_API RImageWidget: public RWidget
{
    ROBJECT
public:    
    RImageWidget(){};

    RFIELD()
    TWidgetAttribute<TSharedObjectPtr<RTexture2D>> Image;

    RFIELD()
    TWidgetAttribute<EImageWidgetScaleMethod> ScaleMethod=EImageWidgetScaleMethod::Fill;

    //额外的颜色乘数
    RFIELD()
    TWidgetAttribute<SColor> TintColor=SColor(1,1,1,1);

    //UVRect is only valid when ScaleMethod is Custom
    //UVRect provide the UV rect to scale the texture
    RFIELD()
    TWidgetAttribute<SVec2> CustomLeftTopUV=SVec2(0,0);

    RFIELD()
    TWidgetAttribute<SVec2> CustomRightBottomUV=SVec2(1,1);


protected:
    virtual void PaintSelf(uint16_t& InZOrder,const SRect& InClipArea) override;

};